home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / xdme_1.84_src.lha / XDME / Lib / include / AVL.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-22  |  2.0 KB  |  75 lines

  1. /******************************************************************************
  2.  
  3.     MODULE
  4.     AVL.c
  5.  
  6.     DESCRIPTION
  7.     Header file for AVL-trees
  8.  
  9.     HISTORY
  10.     05-07-93 b_noll created
  11.     16-11-94 b_noll removed tn_Name fields - use userfunctions
  12.     $Date: $ last update
  13.  
  14. ******************************************************************************/
  15.  
  16. #ifndef AVL_H
  17. #define AVL_H
  18.  
  19. /**************************************
  20.         Includes
  21. **************************************/
  22.  
  23. /* for BYTE, UBYTE */
  24. #ifndef   EXEC_TYPES_H
  25. #include <exec/types.h>
  26. #endif /* EXEC_TYPES_H */
  27.  
  28. /**************************************
  29.         Global Variables
  30. **************************************/
  31.  
  32. /* none */
  33.  
  34. /**************************************
  35.         Defines & Structures
  36. **************************************/
  37.  
  38. struct TreeNode {
  39.     struct TreeNode * tn_Left;
  40.     struct TreeNode * tn_Right;
  41.     UBYTE          tn_Type;
  42.     BYTE          tn_Balance; /* !PRIVATE! for AVL - do not use it! */
  43. }; /* struct TreeNode */
  44.  
  45. #define AVL_SCAN_PRAEFIX  0
  46. #define AVL_SCAN_INFIX      1
  47. #define AVL_SCAN_POSTFIX -1
  48.  
  49.  
  50. /**************************************
  51.         Macros
  52. **************************************/
  53.  
  54. /* none */
  55.  
  56. /**************************************
  57.         Prototypes
  58. **************************************/
  59.  
  60. struct TreeNode* AVL_Find     (struct TreeNode** tree, int (*check)  (struct TreeNode *, APTR), APTR userdata);
  61. struct TreeNode* AVL_Append   (struct TreeNode** tree, int (*compare)(struct TreeNode *, struct TreeNode *), struct TreeNode* obj);
  62. struct TreeNode* AVL_Remove   (struct TreeNode** tree, int (*compare)(struct TreeNode *, struct TreeNode *), struct TreeNode* obj);
  63. void         AVL_FreeTree (struct TreeNode** tree, void (*freefunc)(struct TreeNode *));
  64. void         AVL_ScanTree (struct TreeNode** tree, void (*scanfunc)(struct TreeNode *), char mode);
  65.  
  66. void         AVL_Init     (struct TreeNode** tree);
  67.  
  68. #define AVL_Init(t) *(t) = NULL;
  69.  
  70. #endif /* !AVL_H */
  71.  
  72. /******************************************************************************
  73. *****  END AVL.c
  74. ******************************************************************************/
  75.